package com.swf.seed.netty.client.handler;

import java.util.Date;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
@Sharable
public class DiscardClientHandler extends SimpleChannelHandler {
	
	@Override
	public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
			throws Exception {
		
         System.out.println("client messageReceived");   
 
	}
	
	@Override
	public void writeRequested(ChannelHandlerContext ctx, MessageEvent e)
			throws Exception {
		System.out.println(this.getClass().getName()+" writeRequested");
		e.getChannel().write("1111");
	}
	
	@Override  
	 
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {   

        e.getCause().printStackTrace();   

        e.getChannel().close();   

    }   
}
